Skip to content

LLVM and SPIRV-LLVM-Translator pulldown (WW09-13) #3425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3,947 commits into from
Mar 30, 2021
Merged

Conversation

vmaksimo
Copy link
Contributor

@vmaksimo vmaksimo commented Mar 26, 2021

alex-t and others added 30 commits March 24, 2021 14:14
…int when folds EXEC copy

Folding EXEC copy into it's single use may lead to constant bus constraint violation as it adds one more SGPR operand.
         This change makes it validate the user instruction with the new SGPR operand and only fold it if it is legal.

Reviewed By: rampitec, arsenm

Differential Revision: https://reviews.llvm.org/D98888
Cleanup the gather_v8i32_v8i32 IR to more closely match how the middle-end will optimise the vector geps (exposing more splats).

This helps the gather scalarization case a lot, but shows a missed opportunity for AVX512 gathers to recognise uniform-constant indices.

And none of the cases realise that some of the gathers are really blended broadcasts....
…BROADCAST(X)

Prefer broadcast from scalar on AVX targets as this makes it easier for later folds to strip away bitcasts etc.

This helps a lot with the AVX1 poor codegen from PR49658.

There's a trivial regression in bitcast-int-to-vector-bool-*ext.ll tests due to SimplifyDemandedBits not being able to see a multi-use case, but there's bigger existing codegen issues to be addressed first in those tests (unnecessary NOTs).
Fix the BlockAndValueMapping update that was missing entries for scf.for op's blockIterArgs.
Skip cloning subtensors of the padded tensor as the logic for these is separate.
Add a filter to drop side-effecting ops.

Tests are beefed up to verify the IR is sound in all hoisting configurations for 2-level 3-D tiled matmul.

Differential Revision: https://reviews.llvm.org/D99255
Removed redundant code for IsConsecutive variable.
Files compiled with C++ for OpenCL mode can now have a distinct
file extension - clcpp, then clang driver picks the compilation
mode automatically (-x clcpp) without the use of -cl-std=clc++.

Differential Revision: https://reviews.llvm.org/D96771
Summary:
Currently the OMPIRBuilder overwrites the function's existing attributes
when it assigns the ones defined in OMPKinds.def. This changes the
behaviour to append the current function's attributes with them instead.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D98740
The option `--prefix-strip` is only used when `--prefix` is not empty.
It removes N initial directories from absolute paths before adding the
prefix.

This matches GNU's objdump behavior.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D96679
Add an option to tell the compiler that it can use privileged instructions.

This patch only adds the option. Backend implementation will be added in a
future patch.

Reviewed By: lei, amyk

Differential Revision: https://reviews.llvm.org/D99193
As an extension, accept such lambdas in previous standards with a warning.

* http://eel.is/c++draft/expr.prim.lambda
* http://wg21.link/P1102

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D98433
This diff patch fixes issue with new line character after check name and before comma. Also ignores all other types of spaces like TAB.

Test Plan: ninja check-clang-tools

Differential Revision: https://reviews.llvm.org/D99180
… to vXi1

If we're truncating to vXi1 from a wider type, then prefer the original wider vector as is simplifies folding the separate truncations + extensions.

AVX1 this is only worth it for v8i1 cases, not v4i1 where we're always better off truncating down to v4i32 for movmsk.

Helps with some regressions encountered in D96609
ModuleOp is a natural place to provide scoped data layout information. However,
it is undesirable for ModuleOp to implement the entirety of
DataLayoutOpInterface because that would require either pushing the interface
inside the IR library instead of a separate library, or putting the default
implementation of the interface as inline functions in headers leading to
binary bloat. Instead, ModuleOp accepts an arbitrary data layout spec attribute
and has a dedicated hook to extract it, and DataLayout is modified to know
about ModuleOp particularities.

Reviewed By: herhut, nicolasvasilache

Differential Revision: https://reviews.llvm.org/D98500
This is useful for bit-packing types such as vectors and tuples as well as for
exotic architectures that have non-8-bit bytes.

Depends On D98500

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D98524
…ation

Even if the layout specification is missing from an op that supports it, the op
is still expected to provide meaningful responses to data layout queries.
Forward them to the op instead of directly calling the default implementation.

Depends On D98524

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D98525
Index type is an integer type of target-specific bitwidth present in many MLIR
operations (loops, memory accesses). Converting values of this type to
fixed-size integers has always been problematic. Introduce a data layout entry
to specify the bitwidth of `index` in a given layout scope, defaulting to 64
bits, which is a commonly used assumption, e.g., in constants.

Port builtin-to-LLVM type conversion to use this data layout entry when
converting `index` type and untie it from pointer size. This is particularly
relevant for GPU targets. Keep a possibility to forcibly override the index
type in lowerings.

Depends On D98525

Reviewed By: herhut

Differential Revision: https://reviews.llvm.org/D98937
- https://reviews.llvm.org/rGb605cfb336989705f391d255b7628062d3dfe9c3 was reverted due to sanitizer bugs in the introduced unit-test (specifically in the Address sanitizer https://lab.llvm.org/buildbot/#/builders/5/builds/5697)
- This patch attempts to rectify that, as well as re-factor parts of the test
- The issue was previously, within the `setupCallToAsmParser` function in the unit-test, `SrcMgr` was declared as a local variable. `SrcMgr` owns a unique pointer. Since the variable goes out of scope at the end of the function, the unique pointer is released.
- This patch, moves the declaration of the `SrcMgr` variable to a class field, since the scope will remain until the class's destructor is invoked (which in this case is at the end of the unit test)
- Furthermore, this patch also moves the `MCContext Ctx` declaration from a local variable instance inside a function, to a unique pointer class field. This ensures the instantiation of the MCContext remains until the tear down of the test.

Reviewed By: abhina.sreeskantharajan

Differential Revision: https://reviews.llvm.org/D99004
The targets polly-update-format and check-polly-format process new files
only after running cmake again. This is why it was missed in the last
commit.
The VSelectCombine handler within AArch64ISelLowering,
uses an interface call which only expects fixed vectors.
This generates a warning when the call is made on a
scalable vector. This warning has been suppressed with this change,
by using the ElementCount interface, which supports both fixed and scalable vectors.
I have also added a regression test which recreates the warning.

Differential Revision: https://reviews.llvm.org/D98249
This reverts commit 50fd426
and tweaks things for the reland: SystemZAsmLexer is now
SystemZAsmLexerTests.
This patch changes the interface to take a RegisterKind, to indicate
whether the register bitwidth of a scalar register, fixed-width vector
register, or scalable vector register must be returned.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D98874
Potential missing fold noted in D98152
All linalg operations having a region builder shall call it during op creation. Calling it during vectorization is obsolete.

Differential Revision: https://reviews.llvm.org/D99168
  CONFLICT (content): Merge conflict in clang/lib/Frontend/CompilerInvocation.cpp
  CONFLICT (content): Merge conflict in clang/lib/Driver/Types.cpp
Nuullll and others added 7 commits March 26, 2021 15:18
The uniqued node could have a different address.

Signed-off-by: Yilong Guo <yilong.guo@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@e5fb547
By default ccache is enabled.

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@336a61d
* [SPIRV] Encode CodeView checksum information in SPIR-V

This is a workaround to keep CodeView checksum information throughout the
translation. The idea is to store checksum kind and value to Ops[TextIdx]
and then parse this string while creating DIFile.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@aa78268
* Print path info in error messages only in debug build

Signed-off-by: Dmitry Sidorov <dmitry.sidorov@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@64be6c6
SPIRV translator does not have the facilities to preserve the size specified
in the DICompositeType node for DW_TAG_array_type.  Instead, it relies on the
size of the underlying base type to calculate the intended size. In
cases when the underlying base type is typedef - this size can`t be
restored. This commit introduces a way to recursively traverse the
definition of the base type to restore the original size

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@767f672
@bader
Copy link
Contributor

bader commented Mar 26, 2021

It looks like there are some issues in conflict resolution for libclc CMakeLists.txt.

CMake Warning (dev) in /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/libclc/CMakeLists.txt:
  A logical block opening on the line
    /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/libclc/CMakeLists.txt:81 (if)
  closes on the line
    /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/libclc/CMakeLists.txt:83 (endif)

@bader
Copy link
Contributor

bader commented Mar 26, 2021

/summary:run

@bader
Copy link
Contributor

bader commented Mar 26, 2021

@vmaksimo, it looks like collectUsedGlobalVariables API has changed in llorg and we need to adjust GlobalOffset.cpp.

FAILED: lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/SYCL/GlobalOffset.cpp.o 
/usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Target/NVPTX -I/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX -Iinclude -I/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3  -fvisibility=hidden    -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/SYCL/GlobalOffset.cpp.o -MF lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/SYCL/GlobalOffset.cpp.o.d -o lib/Target/NVPTX/CMakeFiles/LLVMNVPTXCodeGen.dir/SYCL/GlobalOffset.cpp.o -c /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp
/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp: In static member function 'static llvm::DenseMap<llvm::Function*, llvm::MDNode*> {anonymous}::GlobalOffset::getEntryPointMetadata(llvm::Module&)':
/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp:324:63: error: invalid initialization of reference of type 'llvm::SmallVectorImpl<llvm::GlobalValue*>&' from expression of type 'llvm::SmallPtrSet<llvm::GlobalValue*, 8>'
     collectUsedGlobalVariables(M, Used, /*CompilerUsed=*/false);
                                                               ^
In file included from /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/include/llvm/IR/IRBuilder.h:38:0,
                 from /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp:19:
/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/include/llvm/IR/Module.h:907:17: note: in passing argument 2 of 'llvm::GlobalVariable* llvm::collectUsedGlobalVariables(const llvm::Module&, llvm::SmallVectorImpl<llvm::GlobalValue*>&, bool)'
 GlobalVariable *collectUsedGlobalVariables(const Module &M,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp:325:62: error: invalid initialization of reference of type 'llvm::SmallVectorImpl<llvm::GlobalValue*>&' from expression of type 'llvm::SmallPtrSet<llvm::GlobalValue*, 8>'
     collectUsedGlobalVariables(M, Used, /*CompilerUsed=*/true);
                                                              ^
In file included from /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/include/llvm/IR/IRBuilder.h:38:0,
                 from /localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/lib/Target/NVPTX/SYCL/GlobalOffset.cpp:19:
/localdisk2/sycl_ci/buildbot/worker/Lit_With_Cuda/llvm.src/llvm/include/llvm/IR/Module.h:907:17: note: in passing argument 2 of 'llvm::GlobalVariable* llvm::collectUsedGlobalVariables(const llvm::Module&, llvm::SmallVectorImpl<llvm::GlobalValue*>&, bool)'
 GlobalVariable *collectUsedGlobalVariables(const Module &M,
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

mlychkov and others added 5 commits March 26, 2021 17:33
Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
20 lit tests for CUDA are failed with the following assert:
"clang-13: llvm/lib/Transforms/Utils/CloneFunction.cpp:152:
 void llvm::CloneFunctionInto(llvm::Function*, const llvm::Function*,
                              llvm::ValueToValueMapTy&,
                              llvm::CloneFunctionChangeType,
                              llvm::SmallVectorImpl<llvm::ReturnInst*>&,
                              const char*, llvm::ClonedCodeInfo*,
                              llvm::ValueMapTypeRemapper*,
                              llvm::ValueMaterializer*)
   : Assertion `(NewFunc->getParent() == nullptr ||
                 NewFunc->getParent() != OldFunc->getParent()) &&
                "Set SameModule to true if the new function is in the same module"' failed."

Change CloneFunctionChangeType to pass those lit tests.

Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
SemaOpenCL/func.cl started to fail after intel#3425

Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
@vmaksimo
Copy link
Contributor Author

/summary:run

@bader
Copy link
Contributor

bader commented Mar 31, 2021

@vmaksimo, @vladimirlaz, it looks like this PR introduces post-commit failures to the build with clang and shared LLVM libraries:

/home/runner/work/llvm/llvm/src/sycl/include/CL/sycl/types.hpp:2039:35: error: extra ';' outside of a function is incompatible with C++98 [-Werror,-Wc++98-compat-extra-semi]
__SYCL_DECLARE_TYPE_VIA_CL_T(char);
^

FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o
/usr/bin/clang++-13 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/home/runner/work/llvm/llvm/src/llvm/lib/Support -Iinclude -I/home/runner/work/llvm/llvm/src/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -fPIC -UNDEBUG -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o -c /home/runner/work/llvm/llvm/src/llvm/lib/Support/Host.cpp
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/bin/clang++-13 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Support -I/home/runner/work/llvm/llvm/src/llvm/lib/Support -Iinclude -I/home/runner/work/llvm/llvm/src/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -fPIC -UNDEBUG -std=c++14 -fno-exceptions -fno-rtti -MD -MT lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o -MF lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o.d -o lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o -c /home/runner/work/llvm/llvm/src/llvm/lib/Support/Host.cpp

  1. parser at end of file
  2. Code generation
  3. Running pass 'Function Pass Manager' on module '/home/runner/work/llvm/llvm/src/llvm/lib/Support/Host.cpp'.
  4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@_ZN4llvm3sys6detail3x8618getVendorSignatureEPj'

Please, fix ASAP.

@bader
Copy link
Contributor

bader commented Mar 31, 2021

Second item seems to be unrelated to the pulldown, but rather it's a bug in the clang from the repo we use.
@alexbatashev, are we using clang's nightly builds from llorg in post-commit? If so, what is the mitigation plan? Can we rollback to the working version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.